package com.zk.virtual;

/**
 * virtual 是Java Class的基础属性。
 */
public class VirtualChild extends VirtualBase {
    /**
     * static 方法不是virtual的
     */
    public static void test() {
        System.out.println("this is called in child.");
    }

    public void testVirtual() {
        System.out.println("testVirtual is called in Child.");
    }

    public static void main(String[] args) {
        VirtualChild child = new VirtualChild();
        child.test();// this is called in child.
        VirtualBase base = child;
        base.test(); // this is called in base.

        child.testVirtual();
    }

}
